﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace QL_KhachHang
{
    public partial class FrmInHoaDon : Form
    {
        public FrmInHoaDon()
        {
            InitializeComponent();
        }
        private void FrmInHoaDon_Load(object sender, EventArgs e)
        {
            string str = @"Data Source=.\SQLEXPRESS;Initial Catalog=D:\HUYEN_KH\DOCS\CSDL\QLKHACHSAN.MDF;Integrated Security=True";
            SqlConnection con = new SqlConnection(str);
            string sql = "select k.TenKH, n.MaPhong,h.SoNgayO,h.GiaPhong,h.ThanhTien  from HoaDon h,KhachHang k,NhatKyPhong n where h.MaKH=k.MaKH and h.MaNhatKy=n.MaNhatKy and h.MaHD='HD00001' ";
            SqlDataAdapter da = new SqlDataAdapter(sql,con);
            DataSet1 dt = new DataSet1();
            da.Fill(dt);
            CRHoaDon cd = new CRHoaDon();
            cd.SetDataSource(dt);
            crystalReportViewer1.ReportSource = cd;
        }
    }
}
